<extend name="Layout:form" />
<block name="subheader">
    <script language="javascript" type="text/javascript" src="{:asset('js/admin/content_add.js')}" charset="UTF-8"></script>
    <script type="text/javascript" src="{:asset('js/admin/attachupload.js')}"></script>
    <script type="text/javascript" src="{:asset('js/ckeditor/ckeditor.js')}"></script>
</block>
<block name="main">
    <form name="myform" id="myform" action="" method="post" enctype="multipart/form-data">
        <input type="hidden" name="id" value="<?php echo $content['id']; ?>" />
        <input type="hidden" name="moduleid" value="<?php echo $module['id']; ?>">
        <div class="post-body clear" style="margin-right: 300px;">
            <div class="common-form post-body-content" style="width: 100%; min-width: 463px; float: left;">
                <table width="100%" cellspacing="0" class="table_form">
                    <tbody>
                        <?php if(is_array($forminfos)) {
                            foreach($forminfos as $field=>$info) {
                                if($info['isomnipotent']) continue;
                                if($info['formtype']=='omnipotent') {
                                    foreach($forminfos as $_fm=>$_fm_value) {
                                        if($_fm_value['isomnipotent']) {
                                            $info['form'] = str_replace('{'.$_fm.'}',$_fm_value['form'],$info['form']);
                                        }
                                    }
                                }
                                ?>
                                <tr>
                                    <th width="80"><?php if($info['star']){ ?> <font color="red">*</font><?php } ?> <?php echo $info['name']?>
                                    </th>
                                    <td><?php echo $info['form']?>  <?php echo $info['tips']?></td>
                                </tr>
                                <?php
                            }
                        } ?>
                    </tbody>
                </table>
            </div>
            <div class="post-body-sidebar" style="margin-right: -300px; width: 280px; float: right;">
                <div class="postbox">
                    <h3 class="title">
                        <span>发布</span>
                    </h3>
                    <div class="inside">
                        <div class="major-content">
                            <?php if(session('user_info.role_id')==1) { ?>
                            <label for="post_status">状态：</label>
                            <label><input type="radio" name="info[status]" value="99" checked/> 发布 </label>
                            <label><input type="radio" name="info[status]" value="1" > 审核 </label>
                            <?php } ?>
                        </div>
                        <div class="major-operate clear">
                            <div class="left-link"></div>
                            <div class="right-button">
                                <input name="dosubmit" type="submit" class="button-primary bt-button" value="提交">
                            </div>
                        </div>
                    </div>
                </div>

                <?php foreach ($taxonomies as $taxonomy) { ?>
                <div class="postbox">
                    <h3 class="title">
                        <span><?php echo $taxonomy['label'] ?></span>
                    </h3>
                    <div class="inside">
                        <div class="major-content">
                            <?php echo \Org\Util\Form::taxonomy($termsGroupByTaxonomy[$taxonomy['name']], $taxonomy['name'], $post_terms); ?>
                        </div>
                        <div class="major-operate clear">
                            <div class="left-link">
                                <a href="javascript:void(0);window.top.art.dialog({id:'notice',content:'开发中……',lock:true});">添加<?php echo $taxonomy['label'] ?></a>
                            </div>
                            <div class="right-button"></div>
                        </div>
                    </div>
                </div>
                <?php } ?>
            </div>
        </div>
    </form>
</block>
<block name="footer">
    <script type="text/javascript">
        $(function(){
            $.formValidator.initConfig({formid:"myform",autotip:true,onerror:function(msg,obj){window.top.art.dialog({id:'check_content_id',content:msg,lock:true},   function(){$(obj).focus();
                boxid = $(obj).attr('id');
                if($('#'+boxid).attr('boxid')!=undefined) {
                    check_content(boxid);
                }
            })}});
            <?php echo $formValidator;?>
        });
    </script>
</block>